/**
 * 
 */
package org.swing.utility.jdbc.base.dao;

import java.util.List;

import org.swing.utility.jdbc.transaction.Transaction;

/**
 * @author lqnhu
 *
 */
public interface IBaseDAO<T> {
	public String tableName();

	public int insertItem(T item, boolean returnAutoIncrement)
			throws DAOException;

	public int insertItem(Transaction trans, T item, boolean returnAutoIncrement)
			throws DAOException;

	public int count(Condition[] conds) throws DAOException;

	public int count(Transaction trans, Condition[] conds) throws DAOException;

	public int namedCount(String query, Object[] values) throws DAOException;

	public int namedCount(Transaction trans, String query, Object[] values)
			throws DAOException;

	public T queryItem(Condition[] conds) throws DAOException;

	public T queryItem(Transaction trans, Condition[] conds)
			throws DAOException;

	public List<T> queryItemsByPage(Condition[] conds, int start, int size,
			OrderBy... orderBys) throws DAOException;

	public List<T> queryItemsByPage(Transaction trans, Condition[] conds,
			int start, int size, OrderBy... orderBys) throws DAOException;

	public List<T> queryAllItems(Condition[] conds, OrderBy... orderBys)
			throws DAOException;

	public List<T> queryAllItems(Transaction trans, Condition[] conds,
			OrderBy... orderBys) throws DAOException;

	public T namedQuery(String query, Object[] values) throws DAOException;

	public T namedQuery(Transaction trans, String query, Object[] cond)
			throws DAOException;

	public List<T> namedQueryAll(String query, Object[] values)
			throws DAOException;

	public List<T> namedQueryAll(Transaction trans, String query,
			Object[] values) throws DAOException;

	public List<T> namedQueryByPage(String query, Object[] values, int start,
			int size) throws DAOException;

	public List<T> namedQueryByPage(Transaction trans, String query,
			Object[] values, int start, int size) throws DAOException;

	public int updateItems(T item, Condition[] conds) throws DAOException;

	public int updateItems(Transaction trans, T item, Condition[] conds)
			throws DAOException;

	public int namedUpdateItems(String update, Object[] values)
			throws DAOException;

	public int namedUpdateItems(Transaction trans, String update,
			Object[] values) throws DAOException;

	public int deleteItem(Condition[] conds) throws DAOException;

	public int deleteItem(Transaction trans, Condition[] conds)
			throws DAOException;
}
